Checks for the presence of a parameters that haven't yet been retrieved from the Apple event. Uses the method of getting the attribute keyMissedKeywordAttr.
OSErr DecodeOrdinal(AEDesc ordData, long count, long* index,
Boolean* allFlag, Boolean* zeroFlag);
This routine was lifted from the sample code for the app Scriptable Text Editor. Here's the description from the source file.
This routine is used whenever an element is specified by an absolute position
within a sequence of elements - such as "word 3 of window 'johnson'", "any line
of item 17 of window 'Kelvin'", etc. The data specifying the position can be
a positive integer (which just means the actual position of the element in the
sequence: 1 for the first element, 2 for the second, etc.), a negative integer
(which indicates position relative to the last element of the sequence: -1 is
the last element, -2 the next to last, etc.), or a descriptor of typeAbsoluteOrdinal:
kAEFirst, kAELast, kAEMiddle, kAEAny, or kAEAll.
DecodeOrdinal takes the data specifying the position, and a count of all the elements
in the sequence under consideration, and returns (whenever possible) a positive integer
(in the return VAR index) representing the actual position of the element in the sequence
(1 for first, 2 for second, etc.). It also returns flags indicating (a) whether the
ordinal was kAEAll and (b) whether the count was 0; both of these are conditions that
many calling routines will have to special-case. In the case of kAEAll, the return VAR
index is set to the count; in the case of count = 0, the return VAR index is set to 0.
There are a few error conditions: (a) count < 0; (b) bad ordData (not an integer, and
not one of the five defined absolute ordinal specifiers). **CHECK - should "integer ordData
out of range" (for example, an integer > count, or < -count, or = 0) be an error,
or should we allow that so that people can talk about "the hypothetical element
beyond the last", or whatever? For now, let's make that a non-error.
INPUTS: ordData a descriptor that specifies an ordinal - either
an integer (positive or negative) or something
of typeAbsoluteOrdinal
count the total number of elements in the group involved
(number of windows, number or chars, or whatever)
index return VAR for the actual position being described
allFlag return VAR: TRUE if the ordData was kAEAll, FALSE o.w.
zeroFlag return VAR: TRUE if the count was zero (for many
calling routines this is an error condition), FALSE o.w.
Updates the user token in odToken with data in desc. desc is disposed.
OSErr ODDisposeAppleEvent( AppleEvent* aevt );
Call this to dispose an AppleEvent that was created by copying (e.g., using ODDescToAEDesc). Does a double-dispose of the AppleEvent. (If the AppleEvent is a copy of a send-to-self event, the AppleEvent cannot be disposed with a single call to AEDisposeDesc.)